//
//  NoLoginView.m
//  ZITHER
//
//  Created by weixin on 2018/11/21.
//  Copyright © 2018 weixn. All rights reserved.
//

#import "NoLoginView.h"
#import "MeRegisterVC.h"
#import "MeRegisterLoginVC.h"

@implementation NoLoginView

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self setUI];
        [self setMasory];
    }
    return self;
}

-(void)setUI{
    [self addSubview:self.viewSigna];
    [self addSubview:self.imageIsLogin];
    [self addSubview:self.labIsLogin];
    [self addSubview:self.logginBtn];
    [self addSubview:self.taskImageView];
}

-(void)setMasory{
    [self.imageIsLogin mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self).offset(139);
        make.centerX.equalTo(self.mas_centerX).offset(0);
        make.height.mas_equalTo(175);
        make.height.mas_equalTo(215);
    }];
    [self.logginBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.imageIsLogin.mas_bottom).offset(60);
        make.left.equalTo(self).offset(15);
        make.right.equalTo(self).offset(-15);
        make.height.mas_equalTo(45);
    }];
//    [self.labIsLogin mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.top.equalTo(self.imageIsLogin.mas_bottom).offset(10);
//        make.centerX.equalTo(self.mas_centerX).offset(0);
//    }];
    [self.taskImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.logginBtn.mas_bottom).offset(5);
        make.size.mas_equalTo(CGSizeMake(114, 20));
        make.centerX.equalTo(self);
    }];
    [self.viewSigna mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.taskImageView.mas_bottom).offset(47);
        make.left.right.equalTo(self).offset(0);
//        make.bottom.equalTo(self).offset(-TabbarHeight);
        make.height.mas_equalTo(100);
    }];

}

-(MeSignatureV *)viewSigna{
    if (!_viewSigna) {
        _viewSigna = [[MeSignatureV alloc]initWithFrame:CGRectMake(0,kScreenH-75-48-70,kScreenW,75+48)];
        
    }
    return _viewSigna;
}



-(UIImageView *)imageIsLogin{
    if (!_imageIsLogin) {
        _imageIsLogin = [[UIImageView alloc]initWithFrame:CGRectMake(0,0, 215, 175)];
        _imageIsLogin.image = [UIImage imageNamed:@"未登录状态占位图"];
        _imageIsLogin.contentMode = 2;
//        _imageIsLogin.center = self.isLoginView.center;
    }
    return _imageIsLogin;
}

-(QMUILabel *)labIsLogin{
    if (!_labIsLogin) {
        _labIsLogin = [[QMUILabel alloc]initWithFrame:CGRectMake(20,kStatusBarHeight+50, kScreenW, 22)];
//        _labIsLogin.center = self.isLoginView.center;
//        _labIsLogin.centerY = self.isLoginView.centerY+110;
        _labIsLogin.text = @"该页面需要登录";
        _labIsLogin.font = [UIFont systemFontOfSize:14];
        _labIsLogin.textColor = baseColorTheme;
        _labIsLogin.textAlignment = 1;
        _labIsLogin.hidden = YES;
    }
    return _labIsLogin;
}


-(BaseBtn *)logginBtn{
    if (!_logginBtn) {
        _logginBtn = [[BaseBtn alloc]initializeFrame:CGRectMake(0, 0, 1, 1) NormalText:@"登录" NormalTextColor:[UIColor whiteColor] SeleText:@"登录" SeleTextColor:[UIColor whiteColor] font:15 isBold:NO];
        _logginBtn.backgroundColor = baseColorTheme;
        _logginBtn.titleLabel.font = [UIFont fontWithName:@"PingFang-SC-Regular" size:15];

        [_logginBtn setCornerRadiusWithRadius:4 isMasks:YES];
        /** 按钮点击案例 */
        @weakify(self);
        [[_logginBtn rac_signalForControlEvents:(UIControlEventTouchUpInside)] subscribeNext:^(__kindof UIControl * _Nullable x) {
            @strongify(self);
            MeRegisterLoginVC *vc = [[MeRegisterLoginVC alloc]init];
            [self.getNav pushViewController:vc animated:YES];

//            MeRegisterVC *vc = [[MeRegisterVC alloc]init];
        }];
    }
    return _logginBtn;
}

- (UIImageView *)taskImageView {
    if (!_taskImageView) {
        _taskImageView = [UIImageView new];
        if ([Main_Token_Model_MANAGER.isToken isEqualToString:@"0"]) {
//            _taskImageView.image = [UIImage imageNamed:@"我的_送现金（现金任务 上不封顶）"];
        }
    }
    return _taskImageView;
}

@end
